package ch.reevolt.android.simulation;

import ch.reevolt.android.generics.Vector2D;

/**	
 * Represents an object that is simulated by the {@link PhysicsSimulator} class. Such
 * an object should return a speed, position and acceleration {@link Vector2D}.
 * 
 * @version 1.0, April 2010
 * @author <a href='mailto:pandre.mudry&#64;hevs.ch'> Pierre-Andre Mudry</a> 
 */
public abstract class PhysicalObject implements Simulatable {	
	
	protected Vector2D p, s, a;
	protected float mass;
	
	/**
	 * Default constructor
	 */
	public PhysicalObject()
	{
		this(10.0f);
	}
	
	/**
	 * Constructor for an object with a mass
	 * @param mass of the object
	 */
	public PhysicalObject(float mass)
	{
		this.p = new Vector2D(0, 0);
		this.s = new Vector2D(0, 0);
		this.a = new Vector2D(0, 0);		
		this.mass = mass;
	}
		
	/***********************************
	 * Getters and setters 
	 ***********************************/	 	
	public Vector2D getPosition(){
		return p;
	}
	
	public void setPosition(Vector2D p){
		this.p = p;
	}

	public void setAcceleration(Vector2D a) {
		this.a = a;
	}

	public Vector2D getAcceleration(){
		return a;
	}	

	public void setSpeed(Vector2D s){
		this.s = s;
	}

	public Vector2D getSpeed(){
		return s;
	}
	
	public float getMass()
	{
		return mass;
	}

	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString()
	{
		String result = "Position : \t" + p + "\n";
		result += "Speed :\t\t" + s + "\n";
		result += "Acceleration :\t" + a + "\n";
		return result;
	}
	
	/**
	 * From simulatable
	 */
	@Override
	public void step(){
		
	}
}
